package date1128.livecycle;

import java.sql.SQLException;

import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.lu.jdog.util.Resource;

/**
 * @author Yue
 * @date 2017年11月28日 下午5:58:45 
 */
public class SpringTest {

	private static AbstractApplicationContext applicationContext;
	public static void main(String[] args) throws SQLException {
		applicationContext = new ClassPathXmlApplicationContext(Resource.getAssertPath(SpringTest.class,"beans.xml"));
		//注册销毁钩子，否则bean的销毁方法是不会触发的。
		applicationContext.registerShutdownHook();
		
		
		American american = applicationContext.getBean("an",American.class);
		american.play();
		
		System.out.println("\n----------------分割线----------------\n");
		Japanese japanese = applicationContext.getBean("jn",Japanese.class);
		System.out.println("这个日本人的名字："+japanese.getAge());
				
	}

}
